16. Data Binding: Views

2 Databindingviews 2020

Update Note

At timestamp 00:10 in the video above, the app/build.gradle` file demonstrates a now deprecated way of Databinding as:

dataBinding {
         enabled = true
}

We instead recommend using the updated way of Databinding as follows:

buildFeatures {
         dataBinding true
}

Data Binding: Views

Check all the answers that are true for Data Binding.

SOLUTION:
  • Data binding generates the Binding object at compile time for all views in the layout.
  • Accessing views through the Binding object is more efficient than using findViewById.
  • For complex view hierarchies, data binding can be a significant performance gain.
  • findViewById traverses the view hierarchy at runtime to find a view every time it’s called.